﻿import QtQuick 2.2
import QtQuick.Layouts 1.1

Rectangle {
    property bool isselect: false
    signal choose(bool select, int flag)
    width: 200; height: 46
    border.color: qsTr("gray"); border.width: 2

    Text {
        id: text1
        elide: Text.ElideMiddle
        anchors
        {
            left:parent.left; top:parent.top
            leftMargin: 2; topMargin: 2
        }

        text: qsTr("手动")
        width: 100; //height: parent.height/2
    }

    Text {
        id: text2
        elide: Text.ElideMiddle
        anchors
        {
            right: parent.right; top: parent.top
            rightMargin: 2; topMargin: 2
        }

        text: qsTr("防护装置停止")
        width: parent.width/2; //height: parent.height/2
    }

    Text {
        id: text3
        elide: Text.ElideMiddle
        anchors
        {
            left: parent.left; bottom: parent.bottom
            leftMargin: 2; bottomMargin: 2
        }
        text: qsTr("防护装置停止")
        width: parent.width/2; //height: parent.height/2
    }

    Text {
        id: text4
        elide: Text.ElideMiddle
        anchors
        {
            right: parent.right; bottom: parent.bottom;
            rightMargin: 2; bottomMargin: 2;
        }
        text: qsTr("已停止");
        width: parent.width/2; //height: parent.height/2
    }

    MouseArea{
        onClicked: {
            console.log(isselect)
            if(isselect)
            {
                isselect = false;
                parent.color = qsTr("white");
            }
            else
            {
                isselect = true;
                parent.color = "#C0C0C0"
            }
            choose(isselect, 2);
        }
        anchors.fill: parent
    }


}
